#pragma once

#include <math.h>
#include <string.h>
#include <stdio.h>
#include <windows.h>
#include <GL/glpng.h>
#include "globals.h"


/* doesn't find M_PI even with #include <math.h> */
#ifndef M_PI
#define M_PI       3.14159265358979323846
#endif
const float DEG2RAD = M_PI/180;

/* compute cross product (convenience function) */
void normal( float n[], float v0[], float v1[], float v2[] );

void drawPoint(float x, float y, float z);

void drawCircle(float radius, float x, float y);

void drawWedge(float radius, int degrees, float x, float y);

// http://www.ecse.rpi.edu/Homepages/wrf/Research/Short_Notes/pnpoly.html
int pnpoly(int npol, float *xp, float *yp, float x, float y);

void printBitmapString(const char* s);

// http://www.dei.isep.ipp.pt/~matos/cadeiras/2004-05/cgra/docs/manual/glutStrokeCharacter.3GLUT.html
void printString(float x, float y, char* s);

// http://www.nullterminator.net/gltexture.html
GLuint loadTextureRAW( const char * filename, int wrap );

// Loads a PNG as texture
GLuint loadTexturePNG( const char * filename, int wrap );

// Renders a png file into the frame buffer
void renderPNG(const char * filename, float x, float y);